Skip to content

scripts/data-inventory.py: a dataset manifest without a single value - #184

Merged
pedrohcgs merged 2 commits into
mainfrom
feat/data-inventory
Nov 7, 2026
Merged

pedrohcgs merged 2 commits into
mainfrom
feat/data-inventory

Conversation

@pedrohcgs

@pedrohcgs pedrohcgs commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • scripts/data-inventory.py lists every file under the given paths (default data/raw): path, size, SHA-256 and, for tables, row count, column names, and the columns whose names suggest personal data. It never outputs a value.
    • CSV and TSV: a first row is listed as column names only with --header, your check that every file given has a header row. No rule can tell Alice,London from a header. Even with --header, a numeric first row is withheld.
    • .dta, .sav, .sas7bdat, .xpt: read with pyreadstat's metadata-only mode. Parquet: read from its footer. Both only when the package is installed; otherwise just the size and hash are listed.
    • --no-counts drops the row counts.
  • /replication-package builds its dataset manifest from it. On restricted data, the whole manifest (file names, sizes, row counts, column names) goes through the agreement's disclosure review before it leaves the machine or reaches a model.
  • The idea comes from the World Bank's reproducibility skill. That repo has no licence, so this is our own implementation.

Review

  • Codex flagged two problems, both fixed in the second commit with their threads resolved:
    • P1: a headerless file whose first record is all text was listed as column names.
    • P1: the clearance step covered only the column names.

Changed defaults

  • None. This is a new script.

Test plan

  • Six portability cases, passing on Python 3.9 and 3.14:
    • no value appears in the CSV or Markdown output;
    • without --header, no first row is listed, including an all-text one;
    • --no-counts works;
    • a numeric first row is withheld;
    • the hash and a non-ASCII file name survive cp1252;
    • a missing path exits 2.
  • Three mutants each fail only their own case: a value leak, the numeric check turned off, and names listed without --header. Ledger row added.
  • ./scripts/backtest.sh passes all 11 gates. Portability suite: 239 cases.

…ingle value

Path, size, SHA-256 and, for tables, rows, column names and the columns whose names suggest
personal data. CSV/TSV via the standard library, with names withheld when a first row looks
like data; .dta/.sav/.sas7bdat via pyreadstat metadata-only and Parquet via its footer when
installed. /replication-package starts its dataset manifest from it, and on restricted data
the author runs it and shares only the output. Four portability cases (cp1252, non-ASCII
names, hash, missing path); a value-leak mutant and a header mutant each fail their case
(LEDGER row). Idea from the World Bank's reproducibility skill; independent code.
Copilot AI balanced review requested due to automatic review settings November 7, 2026 02:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T02:38:00.361376Z b96ec48 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b96ec487e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/data-inventory.py Resolved
… manifest needs clearance on restricted data

Codex review on PR #184 (two P1s):
- A headerless CSV whose first record is all text (Alice,London) was listed as column names.
  No rule can tell it from a header, so first rows are listed only on --header, the user's
  check that every file given has one; a numeric first row is still withheld.
- On restricted data the instruction cleared only column names, though file names, sizes and
  exact row counts are derived from the data too. The script, /replication-package and the
  CHANGELOG now require the whole manifest to go through the agreement's disclosure review,
  and --no-counts drops the row counts.
Six portability cases; three mutants each fail their own (LEDGER row updated).
@pedrohcgs
pedrohcgs merged commit 819e11e into main Nov 7, 2026
2 checks passed
@pedrohcgs
pedrohcgs deleted the feat/data-inventory branch November 7, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants